import { cloneDeep } from "lodash-es";

interface UseQueryOption {
  reload: () => void; // 刷新表格函数
  query: Record<string, any>; // 表格查询参数 必须是reactive
}

export function useQuery(option: UseQueryOption) {

  const { reload, query } = option;

  const originQuery = cloneDeep(query);

  const reset = () => {
    Object.assign(query, originQuery);
    reload();
  };

  return {
    reset
  }
}